package com.example.myapplication;

import android.util.Log;

import androidx.annotation.NonNull;
import androidx.lifecycle.Lifecycle;
import androidx.lifecycle.LifecycleEventObserver;
import androidx.lifecycle.LifecycleOwner;

public class MyObserver2 implements LifecycleEventObserver {

    private static final String TAG = "MyObserver2";

    @Override
    public void onStateChanged(@NonNull LifecycleOwner lifecycleOwner, @NonNull Lifecycle.Event event) {
        Lifecycle.State currentState = lifecycleOwner.getLifecycle().getCurrentState();
        Log.d(TAG, "onStateChanged: event " + event + " state " + currentState);
    }
}
